# coding:utf-8
import json
from common.request_common import HttpHandle
from utils.logger import Logger
logger = Logger()

class common():

    def __init__(self):
        self.http = HttpHandle()
        logger.info('初始化')

        self.http.login()

    def update_http_headers(self, dict_headers):
        for key in dict_headers:
            self.http.headers[key] = dict_headers[key]

        print(self.http.headers)

    def get_http_headers(self):
        return self.http.headers

    def post(self, url, data=None, convert_to_json=True, **kwargs):
        return json.loads(self.http.post(url, data=data, convert_to_json=convert_to_json, **kwargs).text)